﻿using KPIS.GERP.Models.BGM;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace KPIS.GERP.Models.ICM
{
    [DataContract, Table("IcmReceiveDtl")]
    public class ReceiveDtl
    {
        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [DataMember, Display(Name = "ReceiveDtlId", ResourceType = typeof(Resources.ReceiveDtlResource))]
        public int ReceiveDtlId { get; set; }

        [ForeignKey("Received")]
        [DataMember, Display(Name = "ReceiveId", ResourceType = typeof(Resources.ReceiveDtlResource))]
        public int? ReceiveId { get; set; }

        [DataMember, Display(Name = "DeliveryNoteItemId", ResourceType = typeof(Resources.ReceiveDtlResource))]
        public int DeliveryNoteItemId { get; set; }

        [DataMember, Display(Name = "IsByPassInventory", ResourceType = typeof(Resources.ReceiveDtlResource))]
        public bool? IsByPassInventory { get; set; }

        [ForeignKey("MasResourceItem")]
        [DataMember, Display(Name = "ResourceItemId", ResourceType = typeof(Resources.ReceiveDtlResource))]
        public int? ResourceItemId { get; set; }

        [ForeignKey("MasResourceType")]
        [DataMember, Display(Name = "ResourceTypeId", ResourceType = typeof(Resources.ReceiveDtlResource))]
        public int? ResourceTypeId { get; set; }

        [ForeignKey("MasUnit")]
        [DataMember, Display(Name = "UnitId", ResourceType = typeof(Resources.ReceiveDtlResource))]
        public int? UnitId { get; set; }

        [ForeignKey("MasDepreciationType")]
        [DataMember, Display(Name = "DepreciationTypeId", ResourceType = typeof(Resources.ReceiveDtlResource))]
        public int? DepreciationTypeId { get; set; }

        [ForeignKey("MasBudgetSource")]
        [DataMember]
        public Nullable<int> BgSourceId { get; set; }

        [ForeignKey("ProjectExpense")]
        [DataMember, Display(Name = "ProjectId", ResourceType = typeof(Resources.ReceiveDtlResource))]
        public int? ProjExpId { get; set; }

        [DataMember, Display(Name = "Quantity", ResourceType = typeof(Resources.ReceiveDtlResource))]
        public int Quantity { get; set; }

        [DisplayFormat(DataFormatString = "{0:N4}")]
        [DataMember, Display(Name = "Price", ResourceType = typeof(Resources.ReceiveDtlResource))]
        public decimal Price { get; set; }

        [DataMember, Display(Name = "Remark", ResourceType = typeof(Resources.ReceiveDtlResource))]
        public string Remark { get; set; }

        [DataMember, Display(Name = "Description", ResourceType = typeof(Resources.ReceiveDtlResource))]
        public string Description { get; set; }

        [StringLength(2)]
        [DataMember, Display(Name = "RecordStatus", ResourceType = typeof(Resources.ReceiveDtlResource))]
        public string RecordStatus { get; set; }

        [DataMember, Display(Name = "CreatedBy", ResourceType = typeof(Resources.ReceiveDtlResource))]
        public int CreatedBy { get; set; }

        [DataMember, Display(Name = "CreatedWhen", ResourceType = typeof(Resources.ReceiveDtlResource))]
        public DateTime? CreatedWhen { get; set; }

        [DataMember, Display(Name = "UpdatedBy", ResourceType = typeof(Resources.ReceiveDtlResource))]
        public int? UpdatedBy { get; set; }

        [DataMember, Display(Name = "UpdatedWhen", ResourceType = typeof(Resources.ReceiveDtlResource))]
        public DateTime? UpdatedWhen { get; set; }

        [DataMember]
        public virtual Received Received { get; set; }

        [DataMember]
        public virtual MasResourceItem MasResourceItem { get; set; }

        [DataMember]
        public virtual MasResourceType MasResourceType { get; set; }

        [DataMember]
        public virtual MasUnit MasUnit { get; set; }

        [DataMember]
        public virtual ProjectExpense ProjectExpense { get; set; }

        [DataMember]
        public virtual MasDepreciationType MasDepreciationType { get; set; }

        [DataMember]
        public virtual MasBudgetSource MasBudgetSource { get; set; }
    }
}
